<div class="main_content" style="width:58%;float:right">
	<% if @entity.can_have_stream_seen_by(@current_user) %>
		<div id="personal_stream">
			<h2 style="padding-left:14%"><%= @entity.name %>'s Stream</h2>
			<% messages = [] %>
			<% if @is_group_member%>
				<div class="message_box_send">
					<%= render 'entities/public_popsicle_form' %>
				</div>
			<% end %>
			<% unless @public_messages.empty? %>
				<% @public_messages.each do |m| %>
					<%= render :template => "popsicles/_show_clusters", :locals => { :message => @m = m, :type => @type = "public" } %>
				<% end %>
			<% else %>
				<p><%= @entity.name %> has had no recent activity, why not send them a message?</p>
			<% end %>
		</div>
	<% else %>
		<p>Sorry, this user does not allow people to see their personal stream</p>
	<% end %>	
</div>
<div class="content_left">
	<div class="sidebar_container">
		<h3>Personal Information</h3>
		<p>
		  <b>Name:</b><%= @entity.name %>
		</p>
		<p>
		  <b>Description:</b><%= @entity.description %>
		</p>
		<p>
		  <b>Tagline:</b><%= @entity.tagline %>
		</p>
		<% unless @entity.audio_welcome.url.scan(/(?=missing)/).length > 0 %>
			<p><%= link_to "Play Audio Message", @entity.audio_welcome.url %></p>
		<% end %>
		<% if (Group.exists?@entity.id) %>
			<% if(!Administrate.find_by_entity_id_and_group_id(session[:user_id],@entity.id).nil?) %>
				<%= link_to("Administrate " + @entity.name, edit_entity_path(@entity.id)) %>
			<% end %>
		<% end %>
	</div>	
	<div class="sidebar_container">
		<% message = @is_group ? "Group Members" : "Friends" %>
		<h3><%= message %></h3>
		<ul>
		<% @friends.each do |friend| %>
			<li>
				<% if friend.id == session[:user_id] %>
					<%= link_to friend.name, entity_path(friend.id), :class => "entity_link" %>
				<% else %>
					<%= link_to friend.name, show_friend_path(friend.id), :class => "entity_link" %>
				<% end %>
			</li>
		<% end %>
		</ul>
	</div>
	<% unless (@is_group || @groups == nil) %>
		<div class="sidebar_container">
			<h3> Groups </h3>
			<% @groups.each do |group| %>
				<li>
					<%= link_to group.name, show_friend_path(group.id), :class => "entity_link" %>
				</li>
			<% end %>
		</div>
	<% end %>
	<div class="sidebar_container">
		<h3>Interact With <%= @entity.name %></h3>
		<% interaction = false %>
		<ul>
			<% if @entity.can_be_sent_private_message(@current_user) %>
				<li style="margin-bottom:2%"><%= link_to("Send " + @entity.name + " a private message", send_private_messages_path(@entity.id)) %></li>
				<% interaction = true %>
			<% end %>
			<% unless @is_friend %>
				<% if (@entity.can_be_sent_friend_request(@current_user)) && (!@entity.friends.include?@current_user) %>
					<% if Group.exists?@entity.id %>
						<li><%= link_to("Join the " + @entity.name + " group", add_friend_path(@entity.id)) %></li>
					<% else %>
						<% if @current_user.has_friend_requested(@entity.id) %>
							<li><%= link_to 'Remove friend request sent to ' + @entity.name , remove_friend_request_path(@entity.id) %></li>
						<% else %>
							<li><%= link_to("Request " + @entity.name + " as a friend", add_friend_path(@entity.id)) %></li>
						<% end %>
					<% end %>
					<% interaction = true %>
				<% end %>
			<% end %>
		</ul>
		<% if !interaction %>
			<p><%= @entity.name %> does not allow people to interact with them here</p>
		<% end %>
	</div>			
</div>


